package gui;



/*
 * FileType.java
 *
 * Created on June 11, 2008, 7:04 PM
 */
/**
 *
 * @author  Administrator
 */
public class ChooseFileTypeDialog extends javax.swing.JPanel {

    /** Creates new form FileType */
    private final int IMAGEFILEINDEX = 1;
    private final int TEXTFILEINDEX = 2;
    private final int CUSTOMFILEINDEX = 3;
    private IFileTypeListener fileTypeListener;

    public ChooseFileTypeDialog() {
        initComponents();

    }

    /** This method is called from within the constructor to
     * initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is
     * always regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        fileTypeButtonGroup = new javax.swing.ButtonGroup();
        imageTypeRadioButton = new javax.swing.JRadioButton();
        textTypeRadioButton = new javax.swing.JRadioButton();
        customTypeRadioButton = new javax.swing.JRadioButton();

        setBorder(javax.swing.BorderFactory.createTitledBorder(null, "File Type", javax.swing.border.TitledBorder.DEFAULT_JUSTIFICATION, javax.swing.border.TitledBorder.DEFAULT_POSITION, new java.awt.Font("Tahoma", 1, 11), new java.awt.Color(0, 0, 0))); // NOI18N

        fileTypeButtonGroup.add(imageTypeRadioButton);
        imageTypeRadioButton.setText("Instructions");
        imageTypeRadioButton.addItemListener(new java.awt.event.ItemListener() {
            public void itemStateChanged(java.awt.event.ItemEvent evt) {
                imageTypeRadioButtonItemStateChanged(evt);
            }
        });
        imageTypeRadioButton.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                imageTypeRadioButtonActionPerformed(evt);
            }
        });

        fileTypeButtonGroup.add(textTypeRadioButton);
        textTypeRadioButton.setText("Output Image");
        textTypeRadioButton.addItemListener(new java.awt.event.ItemListener() {
            public void itemStateChanged(java.awt.event.ItemEvent evt) {
                textTypeRadioButtonItemStateChanged(evt);
            }
        });

        fileTypeButtonGroup.add(customTypeRadioButton);
        customTypeRadioButton.setText("Both");
        customTypeRadioButton.addItemListener(new java.awt.event.ItemListener() {
            public void itemStateChanged(java.awt.event.ItemEvent evt) {
                customTypeRadioButtonItemStateChanged(evt);
            }
        });

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this);
        this.setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(imageTypeRadioButton)
                    .addComponent(textTypeRadioButton)
                    .addComponent(customTypeRadioButton))
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addContainerGap()
                .addComponent(imageTypeRadioButton)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addComponent(textTypeRadioButton)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addComponent(customTypeRadioButton)
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
        );
    }// </editor-fold>//GEN-END:initComponents

    public void addFileTypeListener(IFileTypeListener fileTypeListener) {
        this.fileTypeListener = fileTypeListener;
    }

private void imageTypeRadioButtonItemStateChanged(java.awt.event.ItemEvent evt) {//GEN-FIRST:event_imageTypeRadioButtonItemStateChanged
    if (imageTypeRadioButton.isSelected()) {
        fileTypeListener.SetFileChooser(IMAGEFILEINDEX);
        fileTypeListener.SetFileType();
    }
}//GEN-LAST:event_imageTypeRadioButtonItemStateChanged

private void imageTypeRadioButtonActionPerformed(java.awt.event.ActionEvent evt) {
// TODO add your handling code here:
}

private void textTypeRadioButtonItemStateChanged(java.awt.event.ItemEvent evt) {//GEN-FIRST:event_textTypeRadioButtonItemStateChanged
// TODO add your handling code here:
    if (textTypeRadioButton.isSelected()) {
        fileTypeListener.SetFileChooser(TEXTFILEINDEX);
         fileTypeListener.SetFileType();
    }
}//GEN-LAST:event_textTypeRadioButtonItemStateChanged

private void customTypeRadioButtonItemStateChanged(java.awt.event.ItemEvent evt) {//GEN-FIRST:event_customTypeRadioButtonItemStateChanged
// TODO add your handling code here:
    if (customTypeRadioButton.isSelected()) {
        fileTypeListener.SetFileChooser(CUSTOMFILEINDEX);
         fileTypeListener.SetFileType();
    }
}//GEN-LAST:event_customTypeRadioButtonItemStateChanged
    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JRadioButton customTypeRadioButton;
    private javax.swing.ButtonGroup fileTypeButtonGroup;
    private javax.swing.JRadioButton imageTypeRadioButton;
    private javax.swing.JRadioButton textTypeRadioButton;
    // End of variables declaration//GEN-END:variables
}
